/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

def ac_to_id = [:]
def protein_file = new File ("/home/moghadda/Downloads/protein.csv")

protein_file.eachLine{
    def columns = it.replace("\"", "").split(",")
    ac_to_id.put(columns[1], columns[0])
}

//def group_file = new File("/mnt/phoenix/amin/hugo-unix/Documents/projects/stefanDB/literature3.csv")
def group_file = new File("/mnt/phoenix/amin/hugo-unix/Documents/projects/stefanDB/literature_FINAL.csv")

def index = 0


group_file.eachLine { i ->  
    if (index != 0) {
        def columns = i.split("ttt")
        
        
        def id = columns[1]
        
        
        
        def line = columns[0]
        
        if(ac_to_id.containsKey(id)){
                     
            
            line = line + ac_to_id[id]
        }else{
            line = line + "null"
        }
        
        line = line + columns[2]
        
        println line
    }   
    index = 1
}
